﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Fluent="clr-namespace:Fluent" mc:Ignorable="d">
	
  <!--Empty Style - Why?-->
  <Style x:Key="EmptyContextMenuStyle" TargetType="{x:Type ContextMenu}">
    <Setter Property="ToolTip" Value="{x:Null}"></Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ContextMenu}">
				</ControlTemplate>
			</Setter.Value>			
		</Setter>
		<Setter Property="MinWidth" Value="0"/>
		<Setter Property="MaxWidth" Value="0"/>
	</Style>

  <!--Menu Item Style-->
	<Style x:Key="ContextMenuItemStyle" TargetType="{x:Type Fluent:MenuItem}">
		<Setter Property="Template" Value="{DynamicResource ContextMenuItemControlTemplate}"/>
		<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
		<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
		<Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="UseLayoutRounding" Value="True"/>
    <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
    <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
	</Style>

  <!--Menu Item Template-->
	<ControlTemplate x:Key="ContextMenuItemControlTemplate" TargetType="{x:Type Fluent:MenuItem}">
		<Grid Width="Auto" Height="22" Background="#00000000">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="25"/>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="Auto"/>
			</Grid.ColumnDefinitions>
			<Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{DynamicResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3">
				<Border Background="{DynamicResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{DynamicResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1"/>
			</Border>
			<TextBlock x:Name="textBlock_Copy" Text="{TemplateBinding Text}" Width="Auto" Height="Auto" Margin="9,3,30,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" d:LayoutOverrides="Width" Visibility="Hidden" HorizontalAlignment="Left"/>
			<TextBlock x:Name="textBlock" Text="{TemplateBinding Text}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis"/>
			<Rectangle x:Name="rectangle" Fill="{DynamicResource MenuItemCheckBoxBackgroundBrush}" Stroke="{DynamicResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="20" Height="20" RadiusX="1" RadiusY="1" Visibility="Collapsed" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
			<Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor" UseLayoutRounding="True"/>
			<Image x:Name="iconImage" HorizontalAlignment="Center" Margin="3,2,2,2" VerticalAlignment="Center" Width="16" Source="{TemplateBinding Icon}" SnapsToDevicePixels="True" Height="16" RenderOptions.BitmapScalingMode="NearestNeighbor" UseLayoutRounding="True"/>
			<Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,4,0" Width="4" Data="M0,0L1,1 0,2z" Height="6" Grid.Column="3">
				<Path.Fill>
					<LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
						<GradientStop Color="Black" Offset="1"/>
						<GradientStop Color="#FF828282"/>
					</LinearGradientBrush>
				</Path.Fill>
			</Path>
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="IsChecked" Value="True">
				<Setter Property="Visibility" TargetName="rectangle" Value="Visible"/>
			</Trigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="Icon" Value="{x:Null}"/>
					<Condition Property="IsChecked" Value="True"/>
				</MultiTrigger.Conditions>
				<Setter Property="Visibility" TargetName="image" Value="Visible"/>
			</MultiTrigger>
			<Trigger Property="HasItems" Value="False">
				<Setter Property="Visibility" TargetName="path" Value="Collapsed"/>
			</Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsSelected" Value="True"/>
          <Condition Property="IsEnabled" Value="True"/>
        </MultiTrigger.Conditions>        
				<Setter Property="Visibility" TargetName="border" Value="Visible"/>
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5"/>
        <Setter Property="Opacity" TargetName="image" Value="0.5"/>
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5"/>
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect/>
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect/>
          </Setter.Value>
        </Setter>
      </Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

  <Style x:Key="MenuSeparatorStyle" TargetType="{x:Type Separator}">
    <Setter Property="Template" Value="{DynamicResource MenuSeparatorControlTemplate}"/>
  </Style>
  <ControlTemplate x:Key="MenuSeparatorControlTemplate" TargetType="{x:Type Separator}">
    <Grid Height="Auto">
      <Path Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource ContextMenuSeparatorBrush}" StrokeDashArray="2 2" Margin="32,1,3,2" VerticalAlignment="Center" Height="1" Data="M0,0L1,0"/>
    </Grid>
  </ControlTemplate>
  <!--Menu Bar Style-->  
	<Style x:Key="ContextMenuBarStyle" TargetType="{x:Type Fluent:ContextMenuBar}">
		<Setter Property="Template" Value="{DynamicResource ContextPopupMenuControlTemplate}"/>
		<Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
		<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
		<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
		<Setter Property="MinWidth" Value="0"/>
		<Setter Property="MinHeight" Value="0"/>
    <Setter Property="HorizontalAlignment" Value="Left"/>
    <Setter Property="VerticalAlignment" Value="Top"/>
	</Style>
	<ControlTemplate x:Key="ContextPopupMenuControlTemplate" TargetType="{x:Type Fluent:ContextMenuBar}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}"/>
    </ControlTemplate.Resources>
		<Grid Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
			<Grid.RowDefinitions>
				<RowDefinition Height="*"/>
				<RowDefinition Height="10"/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="10"/>
			</Grid.ColumnDefinitions>
			<Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
				<Rectangle.Fill>
					<RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
						<GradientStop Color="#3F000000" Offset="0"/>
						<GradientStop Color="#00000000" Offset="1"/>
					</RadialGradientBrush>
				</Rectangle.Fill>
			</Rectangle>
			<Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
				<Rectangle.Fill>
					<RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
						<GradientStop Color="#3F000000" Offset="0"/>
						<GradientStop Color="#00000000" Offset="1"/>
					</RadialGradientBrush>
				</Rectangle.Fill>
			</Rectangle>
			<Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
				<Rectangle.Fill>
					<RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
						<GradientStop Color="#3F000000" Offset="0"/>
						<GradientStop Color="#00000000" Offset="1"/>
					</RadialGradientBrush>
				</Rectangle.Fill>
			</Rectangle>
			<Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
				<Rectangle.Fill>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
						<GradientStop Color="#3F000000" Offset="0"/>
						<GradientStop Color="#00000000" Offset="1"/>
					</LinearGradientBrush>
				</Rectangle.Fill>
			</Rectangle>
			<Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
				<Rectangle.Fill>
					<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
						<GradientStop Color="#3F000000" Offset="0"/>
						<GradientStop Color="#00000000" Offset="1"/>
					</LinearGradientBrush>
				</Rectangle.Fill>
			</Rectangle>
			<Border SnapsToDevicePixels="True" Background="{DynamicResource ContextMenuBarBackgroundBrush}" BorderBrush="{DynamicResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left" VerticalAlignment="Top">
				<Grid Width="Auto" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
					<Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1"/>
					<Grid Margin="1" HorizontalAlignment="Left" VerticalAlignment="Top">
						<Grid.RowDefinitions>
							<RowDefinition Height="*"/>
							<RowDefinition Height="Auto"/>
						</Grid.RowDefinitions>
            <!--<Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Data="M0,0L0,1" Grid.RowSpan="2" Visibility="Visible"/>-->
            <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource ContextMenuLineBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible"/>
						<Fluent:MenuPanel Margin="0" Width="Auto" Height="Auto" IsItemsHost="True" d:LayoutOverrides="Width, Height" Grid.RowSpan="1" x:Name="PART_ItemsHost" HorizontalAlignment="Left" VerticalAlignment="Top"/>
						<Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" CornerRadius="0,0,1,1" Background="{DynamicResource ContextMenuBarResizeBackgoundBrush}">
							<Grid>
								<Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}"/>
								<Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}"/>
							</Grid>
						</Border>
					</Grid>
				</Grid>
			</Border>
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="FlowDirection" Value="RightToLeft">
				<Setter Property="Cursor" TargetName="PART_ResizeBothThumb" Value="SizeNESW"/>
			</Trigger>
			<Trigger Property="ResizeMode" Value="None">
				<Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed"/>
			</Trigger>
			<Trigger Property="ResizeMode" Value="Both">
				<Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed"/>
				<Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible"/>
				<Setter Property="Visibility" TargetName="resizeBorder" Value="Visible"/>
			</Trigger>
			<Trigger Property="ResizeMode" Value="Vertical">
				<Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed"/>
				<Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible"/>
				<Setter Property="Visibility" TargetName="resizeBorder" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>	
	<Style x:Key="MenuGroupSeparatorStyle" TargetType="{x:Type Fluent:GroupSeparatorMenuItem}">
		<Setter Property="Template" Value="{DynamicResource MenuGroupSeparatorControlTemplate}"/>
		<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
		<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
	</Style>
	<ControlTemplate x:Key="MenuGroupSeparatorControlTemplate" TargetType="{x:Type Fluent:GroupSeparatorMenuItem}">
		<Grid Height="21" Background="#FFF0F2F5">
			<TextBlock Margin="7,0" Text="{TemplateBinding Text}" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold"/>
		</Grid>
	</ControlTemplate>
	<ControlTemplate x:Key="ResizeBothThumbControlTemplate" TargetType="{x:Type Thumb}">
		<Grid Background="#00000000">
			<Rectangle Fill="White" StrokeThickness="0" Width="2" Height="2" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,2,1"/>
			<Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,2,5" VerticalAlignment="Bottom" Width="2" Height="2"/>
			<Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,6,1" VerticalAlignment="Bottom" Width="2" Height="2"/>
			<Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,3,2" VerticalAlignment="Bottom" Width="2" Height="2"/>
			<Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,3,6" VerticalAlignment="Bottom" Width="2" Height="2"/>
			<Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,7,2" VerticalAlignment="Bottom" Width="2" Height="2"/>
		</Grid>
	</ControlTemplate>
	<ControlTemplate x:Key="ResizeVerticalThumbControlTemplate" TargetType="{x:Type Thumb}">
		<Grid Background="#00000000">
			<StackPanel Margin="0,1,0,0" Orientation="Horizontal" d:LayoutOverrides="Height" HorizontalAlignment="Center" VerticalAlignment="Center">
				<Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
					<Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2"/>
					<Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2"/>
				</Grid>
				<Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
					<Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2"/>
					<Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2"/>
				</Grid>
				<Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
					<Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2"/>
					<Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2"/>
				</Grid>
				<Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
					<Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2"/>
					<Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2"/>
				</Grid>
			</StackPanel>
		</Grid>
	</ControlTemplate>
  
  <!-- Default menu style for wpf context menu-->

  <Style TargetType="{x:Type ContextMenu}">
    <Setter Property="Template" Value="{DynamicResource PopupMenuControlTemplate}"/>
    <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
    <Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
    <Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
    <Setter Property="MinWidth" Value="0"/>
    <Setter Property="MinHeight" Value="0"/>
    <Setter Property="HorizontalAlignment" Value="Left"/>
    <Setter Property="VerticalAlignment" Value="Top"/>
  </Style>
  <ControlTemplate x:Key="PopupMenuControlTemplate" TargetType="{x:Type ContextMenu}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}"/>
    </ControlTemplate.Resources>
    <Grid Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
      <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="10"/>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="10"/>
      </Grid.ColumnDefinitions>
      <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
        <Rectangle.Fill>
          <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0"/>
            <GradientStop Color="#00000000" Offset="1"/>
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
        <Rectangle.Fill>
          <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0"/>
            <GradientStop Color="#00000000" Offset="1"/>
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
        <Rectangle.Fill>
          <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0"/>
            <GradientStop Color="#00000000" Offset="1"/>
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
        <Rectangle.Fill>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
            <GradientStop Color="#3F000000" Offset="0"/>
            <GradientStop Color="#00000000" Offset="1"/>
          </LinearGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
        <Rectangle.Fill>
          <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
            <GradientStop Color="#3F000000" Offset="0"/>
            <GradientStop Color="#00000000" Offset="1"/>
          </LinearGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Border SnapsToDevicePixels="True" Background="{DynamicResource ContextMenuBarBackgroundBrush}" BorderBrush="{DynamicResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Grid Width="Auto" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
          <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1"/>
          <Grid Margin="1" HorizontalAlignment="Left" VerticalAlignment="Top">
            <Grid.RowDefinitions>
              <RowDefinition Height="*"/>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource ContextMenuLineBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible"/>
            <StackPanel Margin="0" Width="Auto" Height="Auto" IsItemsHost="True" d:LayoutOverrides="Width, Height" Grid.RowSpan="1" x:Name="PART_ItemsHost" HorizontalAlignment="Left" VerticalAlignment="Top"/>
          </Grid>
        </Grid>
      </Border>
    </Grid>   
  </ControlTemplate>

  <!--Menu Item Style-->
  <Style TargetType="{x:Type MenuItem}">
    <Setter Property="Template" Value="{DynamicResource MenuItemControlTemplate}"/>
    <Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
    <Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
    <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="UseLayoutRounding" Value="True"/>
    <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
    <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
  </Style>

  <!--Menu Item Template-->
  <ControlTemplate x:Key="MenuItemControlTemplate" TargetType="{x:Type MenuItem}">
    <Grid Width="Auto" Height="22" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{DynamicResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3">
        <Border Background="{DynamicResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{DynamicResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1"/>
      </Border>
      <TextBlock x:Name="textBlock_Copy" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,30,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" d:LayoutOverrides="Width" Visibility="Hidden" HorizontalAlignment="Left"/>
      <TextBlock x:Name="textBlock" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis"/>
      <Rectangle x:Name="rectangle" Fill="{DynamicResource MenuItemCheckBoxBackgroundBrush}" Stroke="{DynamicResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="20" Height="20" RadiusX="1" RadiusY="1" Visibility="Collapsed" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor" UseLayoutRounding="True"/>
      <Image x:Name="iconImage" Source="{TemplateBinding Icon}" HorizontalAlignment="Center" Margin="3,2,2,2" VerticalAlignment="Center" Width="16" SnapsToDevicePixels="True" Height="16" RenderOptions.BitmapScalingMode="NearestNeighbor" UseLayoutRounding="True">
      </Image>
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,4,0" Width="4" Data="M0,0L1,1 0,2z" Height="6" Grid.Column="3">
        <Path.Fill>
          <LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
            <GradientStop Color="Black" Offset="1"/>
            <GradientStop Color="#FF828282"/>
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible"/>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}"/>
          <Condition Property="IsChecked" Value="True"/>
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible"/>
      </MultiTrigger>
      <Trigger Property="HasItems" Value="False">
        <Setter Property="Visibility" TargetName="path" Value="Collapsed"/>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True"/>
          <Condition Property="IsEnabled" Value="True"/>
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible"/>
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5"/>
        <Setter Property="Opacity" TargetName="image" Value="0.5"/>
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5"/>
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect/>
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect/>
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

</ResourceDictionary>